package com.opentae.data.mall.interfaces;

import com.opentae.core.mybatis.config.MyBatisRepository;
import com.opentae.core.mybatis.mapper.Mapper;
import com.opentae.data.mall.beans.MallOrder;
import com.opentae.data.mall.pojo.ManagerOrderData;
import com.opentae.data.mall.pojo.OrderData;
import com.opentae.data.mall.pojo.ToSendOrderData;
import org.apache.ibatis.annotations.Param;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;

import java.util.List;

/**
 * 
 * Created by exampleCreater.
 */
@MyBatisRepository("tae_mall_mallOrderMapper")
@Scope("singleton")
@Lazy(true)
public interface MallOrderMapper extends Mapper<MallOrder> {
    MallOrder selectOrderByTradeCode(@Param("tradeCode") String tradeCode);

    /**
     *  用户订单列表
     * @description status 0 全部 1待付款 2待发货 3待收货
     * @author 郭尔
     * @date 2019/1/10 17:01
     */
    List<OrderData> selOrderList(@Param("start") Integer start,@Param("end") Integer end,
                                 @Param("userId") Long userId,@Param("status") Integer status);
    int countOrderList(@Param("userId") Long userId,@Param("status") Integer status);

    /**
     *
     * @description 后台所有已支付的订单
     * @author 郭尔
     * @date 2019/1/12 14:25
     */
    List<ManagerOrderData> allOrderList(@Param("tradeCode")String tradeCode,@Param("start") int start,@Param("size") int size);
    int countAllOrderList(@Param("tradeCode")String tradeCode);

    /**
     * @description 需要发货的列表
     * @author 郭尔
     * @date 2019/1/14 13:41
     */
    List<ToSendOrderData> toSendList(@Param("tradeCode")String tradeCode,@Param("start") int start,
                                     @Param("size") int size,@Param("agentId")String agentId);
    int countToSendOrderList(@Param("tradeCode")String tradeCode,@Param("agentId")String agentId);

    /**
     *
     * @description 后台所有已发货的订单
     * @author 郭尔
     * @date 2019/1/12 14:25
     */
    List<ManagerOrderData> haveSendList(@Param("start") int start, @Param("offset") int offset,
                                        @Param("tradeCode")String tradeCode, @Param("buyerId")String buyerId,
                                        @Param("status")Integer status,@Param("agentId")String agentId);
    int countSendedList(@Param("tradeCode")String tradeCode,@Param("buyerId")String buyerId,
                         @Param("status")Integer status,@Param("agentId")String agentId);

    /**
     *
     * @description
     * @author 郭尔
     * @date 2019/1/14 13:41
     */
    void addRemark(@Param("tradeCode")String tradeCode ,@Param("remark")String remark);

    /**
     *
     * @description 导出全部已付款订单的列表
     * @author 郭尔
     * @date 2019/1/14 17:32
     */
    List<ManagerOrderData> orderList();

    /**
     *
     * @description
     * @author 郭尔
     * @date 2019/1/24 11:11
     */
    List<ToSendOrderData> noSendList();

    /**
     *
     * @description 清除无效订单
     * @author 郭尔
     * @date 2019/1/24 14:29
     */
    void clearOrder(@Param("userId")Long userId);
}
